<%= header %>
<%= boomerangScript %>
<!--
This test calls .abort() on an XHR that's reached readyState 4, which
resets it back to readyState 0.
-->
<script src="41-xhr-abort-on-load.js" type="text/javascript"></script>
<script>
BOOMR_test.init({
	"instrument_xhr": true,
	testAfterOnBeacon: BOOMR.plugins.AutoXHR ? 2 : 1,
	afterFirstBeacon:
		function() {
			if (!BOOMR.plugins.AutoXHR) {
				return;
			}

			// start a XHR
			var xhr = new XMLHttpRequest();

			// this needs to be set before .open() otherwise Boomerang's
			// handler runs first
			xhr.onreadystatechange = function() {
				if (xhr.readyState === 4) {
					xhr.abort();
				}
			};

			xhr.open("GET", "/json");
			xhr.send();
		}
});
</script>
<%= footer %>
